//方法库

// //对象转换字符串
// export const stringify = (params) => {
//     return Object.keys(params)
//         .map((key) => `${key}=$encodeURLComponent(params[key])}`)
//         .join("&");
// };

// //根据参数获取图片

// export const getImgUrl = (url, w, h) => {
//     return `${url}?param =${w}y${h}`;
// };
// export default {
//     stringify,
//     getImgUrl,
// };
export const stringify = (params) => {
    // {x: 1, y: 2}  -> x=1&y=2
    return Object.keys(params)
        .map((key) => `${key}=${encodeURIComponent(params[key])}`)
        .join("&");
};
// 获取歌曲 mp3 链接
export const genSongPlayUrl = (id) => {
    return `https://music.163.com/song/media/outer/url?id=${id}.mp3`;
};

// 根据参数获取图片
export const getImgUrl = (url, w, h) => {
    return `${url}?param=${w}y${h}`;
};

export default {
    stringify,
    getImgUrl,
    genSongPlayUrl,
};